package cn.tedu.ezhaung_project.controller;

import cn.tedu.ezhaung_project.mapper.CountMapper;
import cn.tedu.ezhaung_project.pojo.entity.Location;
import cn.tedu.ezhaung_project.pojo.vo.CountLocationVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/location/")
public class CountController {
    @Autowired
    CountMapper mapper;

    @RequestMapping("select")
    public List<Location> select(Location location){
        return mapper.select(location);
    }

    @RequestMapping("selectProvince")
    public List<CountLocationVO> selectProvince(){
        return mapper.selectProvince();
    }

    @RequestMapping("selectCity")
    public List<CountLocationVO> selectCity(int provinceId){
        System.out.println("provinceId = " + provinceId);
        return mapper.selectCity(provinceId);
    }

    @RequestMapping("selectDistrict")
    public List<CountLocationVO> selectDistrict(int cityId){
        System.out.println("cityId = " + cityId);
        return mapper.selectDistrict(cityId);
    }

}
